import { VIPDescriptionInfo } from "./info/VIPDescriptionInfo";
import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { VIPInfo } from "./info/VIPInfo";
import { StringHelper } from "../../../com/gengine/utils/StringHelper";
import { Vector } from "../../../__AS3__/vec/Vector";
//class VIPConfig
    
    export  class VIPConfig
    {
        constructor(arg1: ConstructorBlock)
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            this._msgDescription = new Map<any, any> /* flash.utils.Dictionary */();
            this._msgsDict = new Map<any, any> /* flash.utils.Dictionary */();
            this._vcMsgs = new Vector.<VIPDescriptionInfo>();
            if (VIPConfig._instance != null) 
            {
                throw new Error(" VIPConfig 单例 ");
            }
            VIPConfig._instance = this;
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_vip.json");
            this.write(loc1);
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new VIPInfo();
                loc1.descStr = StringHelper.getString(loc2.descStr);
                loc1.halfYearVal = loc2.halfYearVal;
                loc1.monthVal = loc2.monthVal;
                loc1.vipAddType = loc2.vipAddType;
                loc1.vipCode = loc2.vipCode;
                loc1.vipName = loc2.vipName;
                loc1.weekVal = loc2.weekVal;
                this._map[loc1.vipName] = loc1;
            }
            return;
        }

        public getVIPInfo(arg1: string): VIPInfo
        {
            if (this._map.hasOwnProperty(arg1)) 
            {
                return this._map[arg1];
            }
            return null;
        }

        public static get instance(): VIPConfig
        {
            if (VIPConfig._instance == null) 
            {
                VIPConfig._instance = new VIPConfig(new ConstructorBlock());
            }
            return VIPConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_msgDescription: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_msgsDict: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_vcMsgs: Vector.<VIPDescriptionInfo>;

        /* internal */ static /* var */_instance: VIPConfig;
    }
}


class ConstructorBlock
{
    public ConstructorBlock()
    {
        
        return;
    }
